<template>
  <div id="app">
    <h1>{{title}}</h1>
    <img src="./assets/logo.png">
    <input v-model="newItem" v-on:keyup.enter="addNew"/>
    <ul>
      <li v-for="item in items" v-bind:class="{finished:item.isFinished}" v-on:click="toggleFinish(item)">
        {{item.label}}
      </li>
    </ul>
  </div>
</template>

<script>
import Store from './store'
console.log(Store)
export default {
 data:function(){
    return {
       title:"this is todo list",
       items:[
            {
              label:'coding',
              isFinished:false
            },
            {
               label:'walking',
               isFinished:true
            }
       ],
       newItem:''
    }
  },
  methods:{
    toggleFinish:function(item){  
        item.isFinished=!item.isFinished
      },
    addNew:function(){
       this.items.push({
          label:this.newItem,
          isFinished:false
       })
       this.newItem
       this.newItem='';
    }
  }
}
</script>

<style>
.finished{
  color:red;
}
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
